/* eslint-disable*/
import axios from 'axios'
import { get, post } from './http'

// =======================> 用户 API
// 登录以写
export const loginIn = (params) => post(`user/login`, params)
// 注册
export const SignUp = (params) => post(`user/reg2`, params)
// 更新用户信息
export const updateUserMsg = (params) => post(`user/updateUser`, params)
// 返回指定ID的用户
//export const getUserOfId = (id) => get(`user/list?uid=${id}`)

//视频api
//获取全部视频
export const getAllVideoList = () => get('video/videoList')
//分类
export const getVideoListOfStyle = (styleid) => get(`video/findVideo?typeid=${styleid}`)

//根据名字模糊查询视频
export const findVideo=(keywords)=>get(`video/findVideo?name=${keywords}`)



// =======================> 收藏 API
//新增收藏
export const setCollect = (params) => post(`collect/add`, params)
// 返回的指定用户ID的收藏列表
export const getCollectionOfUserId = (userId) => get(`collect/findByUserId?userid=${userId}`)
//根据id查询视频
export const findVideoid=(videoid)=>get(`video/findVideo?videoid=${videoid}`)
//删除
export const delCollect = (collectid) => get(`collect/removeById?collectid=${collectid}`)
// =======================> 历史 API
//新增历史
export const setHistory = (params) => get(`history/add`, params)
// 返回的指定用户ID的收藏列表
export const gethistoryOfUserId = (userId) => get(`history/findByUserId?userid=${userId}`)
//根据id查询视频
//删除
export const delHistory = (historyid) => get(`history/delete?historyid=${historyid}`)
// =======================> 广告 API
export const findByVideoid=(videoid)=>get(`advert/findByVideoId?videoid=${videoid}`)